package hihocoder;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Comparator;
import java.util.HashMap;
import java.util.Map;
import java.util.PriorityQueue;
import java.util.Queue;
import java.util.Scanner;

/**
 * 
 */

/**
 * @author zhongfang
 *
 */
public class 拓扑排序二 {

	static class Point implements Comparable<Point>{
		int index;
		int inCount=0;//入度
		int virusCount=0;
		public Point(int i) {
			this.index=i;
		}
		
		ArrayList<Point> neibors=new ArrayList<>();
		@Override
		public int compareTo(Point o) {//按照入度排序
			return this.inCount-o.inCount;
		}
	}
	/**
	 * @param args
	 */
	public static void main(String[] args) {
		Scanner scanner=new Scanner(System.in);
		int N=scanner.nextInt();
		int M=scanner.nextInt();
		int K=scanner.nextInt();
		Map<Integer,Point> dots=new HashMap<>(N);//点的集合
		for (int i = 0; i < K; i++) {//投放病毒d位置
			int index=scanner.nextInt();
			Point point=null;
			if(dots.containsKey(index)){
				point=dots.get(index);
			}else {
				point=new Point(index);
				dots.put(index, point);
			}
			point.virusCount++;
		}
		
		for (int i = 0; i < M; i++) {//边
			int x=scanner.nextInt();
			int y=scanner.nextInt();
			Point xPoint=null;
			Point yPoint=null;
			if(dots.containsKey(y)){
				yPoint=dots.get(y);
			}else {
				yPoint=new Point(y);
				dots.put(y, yPoint);
			}
			if(dots.containsKey(x)){
				xPoint=dots.get(x);
			}else {
				xPoint=new Point(x);
				dots.put(x, xPoint);
			}
			yPoint.inCount++;//有一个入度
			xPoint.neibors.add(yPoint);
		}
		Queue<Point> zeroIn=new ArrayDeque<>();
		for (Point point : dots.values()) {
			if(point.inCount==0)
			{
				zeroIn.add(point);
			}
		}
		//拿出入度为0的点，传染到邻居，再删除节点
		while (!zeroIn.isEmpty()) {
			Point point=zeroIn.poll();
			point.inCount--;//已经访问过，则标记为-1，避免与新的混淆
			for (Point pointNeibor : point.neibors) {
				pointNeibor.virusCount+=point.virusCount;
				if(pointNeibor.virusCount>=142857){
					pointNeibor.virusCount-=142857;
				}
				pointNeibor.inCount--;
				if(pointNeibor.inCount==0){
					zeroIn.add(pointNeibor);
				}
			}
		}
		int totalVirus=0;
		for (Point point : dots.values()) {
			totalVirus+=point.virusCount;
			if(totalVirus>=142857){
				totalVirus-=142857;
			}
		}
		System.out.println(totalVirus);
	}

}
